﻿@model PagedList.IPagedList<Doan.Website.Models.Video>
@using System.Globalization
@foreach (var item in Model)
{
    <div class="bv-Group left clearfix">
        <div class="left w160" style="text-align: center">
            <img src="../..@item.Image" height="130" width="130" alt="Ảnh Minh Họa" class=" img-circle image-home" />
            <span class="label label-success" style="margin-top: 10px;"> @item.Views Lượt xem</span>
        </div>
        <div class="right w450">
            <div style="margin-bottom: 10px;">@Html.ActionLink(item.Name, "VideoDetail", "Home", new { id = item.VideoId }, null)</div>
            <div>@Html.Raw(@item.Content)</div>                        
        </div>
    </div>
}
<script>
    $(document).ready(function () {
        var page = @ViewBag.pageNumber;
        var id = "cmpage" + page;
        $(".pagingbar a").removeClass("active");
        $('#' + id).addClass('cmpageActive');
    });
</script>

@if (Model.PageCount > 1)
{
    <div class="pagingbar">
        @Ajax.ActionLink("Đầu", "ListVideoPartial", new {page = 1}, new AjaxOptions {UpdateTargetId = "listvideo"})
        @Ajax.ActionLink("<", "ListVideoPartial", new {page = Model.PageNumber - 1}, new AjaxOptions {UpdateTargetId = "listvideo"})
        @for (int i = 1; i <= Model.PageCount; i++)
        {
            var page = i.ToString(CultureInfo.InvariantCulture);
            @Ajax.ActionLink(page, "ListVideoPartial", new {page = i}, new AjaxOptions {UpdateTargetId = "listvideo"}, new {@id = "cmpage" + page})
        }
        @Ajax.ActionLink(">", "ListVideoPartial", new {page = Model.PageNumber + 1}, new AjaxOptions {UpdateTargetId = "listvideo"})
        @Ajax.ActionLink("Cuối", "ListVideoPartial", new {page = Model.PageCount}, new AjaxOptions {UpdateTargetId = "listvideo"})
    </div>
}